package com.syy.writableComparable;

import com.syy.flow.FlowBean;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class FlowPartition extends Partitioner<FlowPhone, Text> {
    @Override
    public int getPartition(FlowPhone flowBean, Text text, int numPartitions) {
        // 13812345678
        String phone = text.toString().substring(0, 3);//138
        switch (phone) {
            case "136":
                return 0;
            case "137":
                return 1;
            case "138":
                return 2;
            case "139":
                return 3;
            default:
                return 4;
        }

    }
}
